/*=============================================================================

  UI DEFINITION

  FILE: UI.h
  
  DESCRIPTION

    UI DEFINITION

  EXTERNALIZED FUNCTIONS


   Copyright (c) DaeSung Engineering Inc. All rights reserved.

=============================================================================*/
/*=============================================================================

  EDIT HISTORY

  ---------  -------  -------------------------------------------------------
    when       who       what, where, why
  ---------  -------  -------------------------------------------------------
   03/14/04   nso4th    Initial version

=============================================================================*/

#ifndef _UI_H_
#define _UI_H_

/*=============================================================================
  HEADER INCLUSION
=============================================================================*/
#include <Cust_AppDef.h>
#include <UIvw.h>
#include <UIprm.h>

/*=============================================================================
  CONSTANT DEFINITION
=============================================================================*/
#define UI_STRING_LEN			(128)
#define SLIDING_TIME			(200)
/*-------------------------------------------------------------------
  UI EVENT DEFINITION
-------------------------------------------------------------------*/
typedef enum
{
	UI_VWCHANGE_E = CUST_UI_EVENT_BASE,  // w = new, l = old
	UI_NOTIREQ_E, //w = noti info. call the NBOX_DISP((mcxt)wp)
} UIEvent_e;

/*-------------------------------------------------------------------
  BUTTON & LED STYLE DEFINITION
-------------------------------------------------------------------*/
#define UI_BTN_NOCOLOR				(0xFF000000)

typedef enum
{
	// On & OFF
	UI_BTN_NORMAL_ST, // Pushed = color, Normal = GC_GRAY
	UI_BTN_DISABLE_ST,

	// Select
	UI_BTN_SELECT_ST, // Off

	// Blink
	UI_BTN_BLINK_ST
} UIButton_Style_e;

typedef enum
{
	UI_LED_GRAY_ST,  // Gray
	UI_LED_YELLOW_ST, // Yellow
	UI_LED_GREEN_ST, // Green
	UI_LED_RED_ST, // RED
	UI_LED_BLUE_ST, // RED
	
	UI_LED_REDBLINK_ST, // Red blinking
	UI_LED_YELLOWBLINK_ST,
	UI_LED_GREENBLINK_ST // Green blinking
} UILed_Style_e;

/*=============================================================================
  MACRO DEFINITION
=============================================================================*/
/*=============================================================================
  EXTERNALIZED FUNCION DEFINITION
=============================================================================*/

#if defined(__cplusplus)
extern "C"
{
#endif

/*-------------------------------------------------------------------
  BASIC.CORE.FUNCTIONS
-------------------------------------------------------------------*/
void UIstart(void);
void UIterminate(void);
boolean UIIsInit(void);
void UIcmd(char *strcmd);
boolean UIIsLogIn(void);
void UILogIn(boolean success);

/*-------------------------------------------------------------------
  UI.PARAMETERS
-------------------------------------------------------------------*/
void UIprm_Init(void);
void UIprm_Close(void);

boolean UIprm_Set(dword dwType, dword wParam, dword lParam);
dword UIprm_Get(dword dwType, dword wParam, dword lParam);
boolean UIprm_Load(char *pszName);
boolean UIprm_Save(char *pszName);

/*-------------------------------------------------------------------
  UI.VIEW
-------------------------------------------------------------------*/
void UIvw_Select(dword vwNew);
void UIvw_Eng(boolean enable);
boolean UIvw_IsShowEng(void);
void UIvw_Cam(boolean enable);
boolean UIvw_IsShowCam(void);
void UIvw_Mot(boolean enable);
boolean UIvw_IsShowMot(void);
void UIvw_Axis(boolean enable);
boolean UIvw_IsShowAxis(void);
void UIvw_Dio(boolean enable);
boolean UIvw_IsShowDio(void);
void UIvw_Aio(boolean enable);
boolean UIvw_IsShowAio(void);
/*-------------------------------------------------------------------
  UI.VIEW.TABLE
-------------------------------------------------------------------*/
dword UIsize_TBL(dword sizeIdx);
dword UIcolor_TBL(dword colIdx);
dword UIfont_TBL(dword fontIdx);
dword UIcontrol_TBL(dword conIdx);
char *UIstring_TBL(dword strIdx);

/*-------------------------------------------------------------------
  UI.APPLICATION
-------------------------------------------------------------------*/
void UIapp_Update(void); // Update desplay
void UIapp_RESETSHORT(void);
void UIapp_RESETLONG(void);

void  UIapp_SlideText(char *str, dword color);

BOOL UIapp_MenuCtrl(UINT nID, int nCode, void *pExtra);


// CONTROL.STYLE
//--BUTTON
void UIbtn_Style(GBtn *bn, dword style/*UIButton_Style_e*/, dword color);
void UIbtn_Text(GBtn *bn, char *str, dword color);
//--LED
void UILed_Style(GLed *ln/*UILed_Style_e*/, dword style);
void UILtxt_Style(GLText *ln/*UILed_Style_e*/, dword style);
void UItxt_Color(GText *gt, dword txCOL, dword bkCOL);

void UIbtn_MainOP(dword type, dword event);

/*-------------------------------------------------------------------
  UTILITIES
-------------------------------------------------------------------*/
void MBOX_INFO(const char *pszStr);
void MBOX_WARN(const char *pszStr);
void MBOX_ERR(const char *pszStr);

BOOL MBOX_YESNO(const char *pszStr);
BOOL MBOX_YESNO_WARN(const char *pszStr);


void MBOX_INFO2(const char *msg1, const char *msg2);
void MBOX_WARN2(const char *msg1, const char *msg2);
void MBOX_ERR2(const char *msg1, const char *msg2);

BOOL MBOX_YESNO2(const char *msg1, const char *msg2);
BOOL MBOX_YESNO_WARN2(const char *msg1, const char *msg2);

// void NBOX_SHOW(..)
//  - Noti box... only execute in CWnd* task !!
// void NBOX_REQ(..)
//  - In case of SYSmgr, UImgr,.., Call the NBOX_REQ(..)
void NBOX_SHOW(const char *title, const char *msg, u_int32 disp_time);
void NBOX_REQ(const char *title, const char *msg, u_int32 noti_time);
void NBOX_DISP(mcxt noti_msg); // Call by UI_NOTIREQ_E
void NBOX_HIDE(void);

#define UIstring(str)		UIstring_(str,__FILE__,__LINE__)
char *UIstring_(char *str, const char *pszFile, int32 nLine);

//--------------------------------------------------------------
// BITMAP OPERRATION	// --- 2014.01.15 jyko Add
//--------------------------------------------------------------
void Bmp_Transparent(CDC *pDC, u_int32 bmpID, COLORREF colBK, COLORREF colDEL, int32 sx, int32 sy);
/*-----------------------------------------------------------------------------

  FUNCTION

    Bmp_Transparent

  DESCRIPTION

    Make the transparent bitmap Image

  PARAMETERS

    void Bmp_Transparent(CDC *pDC, UINT bmpID, COLORREF colDEL, int32 sx, int32 sy);

      CDC [in] : Defines a class of device-context objects
      bmpID [in] : Bitmap resource ID
      colDEL [in] : Clear color
      sx [in] : new Image x position
      sy [in] : new Image y position

  EXAMPLE

    Bmp_Transparent(pDC, IDC_BITMAP1, GC_BLACK, 0, 0);
-----------------------------------------------------------------------------*/

#if defined(__cplusplus)
}
#endif

#endif /* _UI_H_ */


/*=============================================================================
  EXTERNALIZED FUNCTION DESCRPTIONS
=============================================================================*/
/*--- END OF UI.H ---*/
